package com.machine.action.buycomponent;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.machine.service.user.BuyComponentServiceDao;
import com.opensymphony.xwork2.ActionSupport;

@Component("deleteBuyComAction")
@Scope(value = "prototype")
public class DeleteBuyComAction extends ActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private BuyComponentServiceDao buyComponentServiceDao;

	private List<Integer> buyComponentId = new ArrayList<Integer>();

	public BuyComponentServiceDao getBuyComponentServiceDao() {
		return buyComponentServiceDao;
	}

	
	@Resource(name = "buyComponentService")
	public void setBuyComponentServiceDao(
			BuyComponentServiceDao buyComponentServiceDao) {
		this.buyComponentServiceDao = buyComponentServiceDao;
	}

	public List<Integer> getBuyComponentId() {
		return buyComponentId;
	}

	public void setBuyComponentId(List<Integer> buyComponentId) {
		this.buyComponentId = buyComponentId;
	}

	@Override
	public String execute() throws Exception {
		
		buyComponentServiceDao.deleteByIdList(buyComponentId);
		return SUCCESS;
	}

}
